package com.fingard.dsp.bank.reqrespobj.balance;

import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;

import com.fingard.FGBiz;
import com.fingard.constant.Format;
import com.fingard.dsp.bank.directbank.specialDeal.BankAreaHelper;
import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.xml.XmlTextReader;

public class Req7505HisBalQry extends RequestBase {

	/* <ActArea></ActArea>
      <ActCur></ActCur>
      <ActNum></ActNum>
      <DateFrom></DateFrom>
      <DateTo></DateTo>*/
	public String actArea = "";
	public String actCur = "";
	public String actNum = "";
	public String dateFrom = "";
	public String dateTo = "";

	public String bankType="";
	//付款方IBAN
	public String payIBAN;
	//时区
	public String timeZone;
	//账户所在行的swiftcode
	public String swiftCode;

	//直联账户权限
	public HashSet<String> directRight;

	private XmlTextReader xmlReader;
	public Req7505HisBalQry(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception{
		reqHeader = p_header;
		xmlReader = p_xmlReader;
		actArea = xmlReader.getSimpleText("ActArea");
		if (FGBiz.dspCenter.convertBankArea) {
			BankAreaHelper bankAreaHelper=new BankAreaHelper(p_header.bankCode,actArea,"");
			bankAreaHelper.toBank();
			actArea=bankAreaHelper.bankAreaCode;
		}
		actCur = xmlReader.getSimpleText("ActCur");
		actNum = xmlReader.getSimpleText("ActNum");
		dateFrom = xmlReader.getSimpleText("DateFrom");
		dateTo = xmlReader.getSimpleText("DateTo");
		bankType=xmlReader.getSimpleText("BankType");
		payIBAN  = xmlReader.getSimpleText("PayIBAN");
		timeZone  = xmlReader.getSimpleText("TimeZone");
		swiftCode = xmlReader.getSimpleText("swiftcode");
		String[] directRights = xmlReader.getSimpleTextNotNull("DirectRight").split(",");
		directRight = new HashSet<String>(Arrays.asList(directRights));
	}

	public Req7505HisBalQry(ReqRespHeader p_header){
		reqHeader = p_header;
	}

	public Date getDateFrom() throws ParseException {
		return Format.Date8Format.parse(dateFrom);
	}

	public Date getDateTo() throws ParseException{
		return Format.Date8Format.parse(dateTo);
	}
}
